'use strict';
module.exports = {
	/**
	 * 获取地址列表和课程信息
	 * @url client/course/kh/getAddressAndCourse 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------

		let address = await vk.baseDao.select({
			dbName: "address",
			getMain: true,
			pageIndex: 1,
			pageSize: 999,
			whereJson: { uid },
			sortArr: [{ "name": "is_default", "type": "desc" }]
		});

		let course = await vk.baseDao.findById({
			dbName: "course",
			id: data.id
		});

		res.data = { address, course }

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
